// 附件信息
import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

const moduleName = commonBaseUrl('A')

// 撤销指派
export function cancelAssignApi(params) {
    return request({
        url: moduleName + 'api/signature/v2/signManage/revokeAssignment',
        method: 'get',
        showLoading: true,
        params
    })
}
// 查询列表
export function getPrjFileInfoApi(data) {
    return request({
        url: moduleName + 'api/attachment/file/getPrjFileInfo',
        method: 'post',
        showLoading: true,
        data
    })
}

// 查询列表不分页
export function queryAttachmentOverview(data) {
    return request({
        url: moduleName + 'api/attachment/file/queryAttachmentOverview',
        method: 'post',
        showLoading: true,
        data
    })
}
//旧的查询附件列表
export function queryTxPrjFileInfo(data) {
    return request({
        url: moduleName + 'api/attachment/file/queryTxPrjFileInfo',
        method: 'post',
        showLoading: true,
        data
    })
}
//新的查询附件列表
export function queryDocInfo(data) {
    return request({
        url: moduleName + 'api/attachment/file/queryDocInfo',
        method: 'post',
        showLoading: true,
        data
    })
}

// 附件上传
export function batchUploadApi(data) {
    return request({
        url: moduleName + 'api/attachment/file/batchUpload',
        method: 'post',
        showLoading: true,
        data
    })
}

// （电子签章）附件上传，和项目不关联
export function signUploadFileWithoutPrj(data) {
  return request({
      url: moduleName + 'api/attachment/signatures/signUploadFile',
      method: 'post',
      showLoading: true,
      data
  })
}

export function txBatchUpload(data) {
    return request({
        url: moduleName + 'api/attachment/file/txBatchUpload',
        method: 'post',
        showLoading: false,
        hideMessage: true,
        data
    })
}

// 获取支持上传类型
export function queryFileWhitelist(data) {
  return request({
    url: moduleName + 'api/attachment/file/queryFileWhitelist?sign='+data,
    method: 'post',
    showLoading: true
  })
}
export function querySuffix() {
    return request({
        url: moduleName + '/api/attachment/file/querySuffix',
        method: 'post',
        showLoading: true
    })
}
// 获取单项工程列表数据
export function querySingleInfo(data) {
    return request({
        url: moduleName + 'api/attachment/file/querySingleInfo',
        method: 'post',
        showLoading: true,
        data
    })
}
// 电子签章上传
export function uploadSignInfoApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/uploadSignInfo',
        method: 'post',
        showLoading: true,
        data
    })
}

// 电子签章指派签署人
export function assignSignatoryApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/assignSignatory',
        method: 'post',
        showLoading: true,
        data
    })
}

// 指派签署人提交接口
export function submitAssignSignatory(data) {
  return request({
      url: moduleName + 'api/signature/v2/assignSignatory',
      method: 'post',
      showLoading: true,
      data
  })
}
export function downloadApi_New(params) {
    return request({
        url: moduleName + 'api/attachment/file/download',
        responseType: 'blob',
        showLoading: false,
        params
    })
}
// 单个文件下载
export function downloadApi(params) {
    return request({
        url: moduleName + 'api/attachment/file/download',
        responseType: 'blob',
        showLoading: true,
        params
    })
}

// 批量文件下载
export function batchDownloadApi(data) {
    return request({
        url: moduleName + 'api/attachment/file/batchDownload',
        responseType: 'blob',
        method: 'post',
        showLoading: true,
        data
    })
}

// 删除
export function batchDeleteApi(data) {
    return request({
        url: moduleName + 'api/attachment/file/batchDelete',
        showLoading: true,
        method: 'post',
        data
    })
}

// 查询项目阶段
export function getPrjStageApi(params) {
    return request({
        url: moduleName + 'api/attachment/file/getPrjStage',
        params
    })
}

// 查询项目节点
export function getPrjNodeNameApi(params) {
    return request({
        url: moduleName + 'api/attachment/file/getPrjNodeName',
        params
    })
}

// 获取当前节点文件类型
export function getPrjFileTypeApi(data) {
    return request({
        url: moduleName + 'api/attachment/file/getPrjFileType',
        method: 'post',
        data
    })
}

// 查询盖章公司基础信息接口
export function querySealInfoApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/querySealInfo',
        method: 'post',
        data
    })
}

// 新自主研发查询盖章公司基础信息接口
export function querySignOrganization(docId, prjId) {
  return request({
      url: moduleName + `api/signature/v2/queryOrganization?docId=${docId}&prjId=${prjId}`,
      method: 'get'
  })
}

// 查询文件是否走电子签章接口
export function queryIfEleSignApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/config/queryIfEleSign',
        method: 'post',
        showLoading: false,
        data
    })
}

// 查询签章盖章单位
export function queryProviderInfoApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/queryProviderInfo',
        method: 'post',
        showLoading: true,
        data
    })
}

// 新增服务商接口
export function saveTemSealInfosApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/saveTemSealInfos',
        method: 'post',
        showLoading: true,
        data
    })
}

// 移除服务商接口
export function removeTemSealByIdsApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/removeTemSealByIds',
        method: 'post',
        showLoading: true,
        data
    })
}

// 查询印章管理员接口
export function querySealApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/querySeal',
        showLoading: false,
        params
    })
}

// 保存指派签署人
export function addSealApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/addSeal',
        showLoading: true,
        params
    })
}

// 查询签署人
export function querySignerApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/querySigner',
        showLoading: false,
        params
    })
}

// 保存指派签署人
export function addSignerApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/addSigner',
        showLoading: true,
        params
    })
}

// 查询人员信息
export function queryPersonApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/queryPerson',
        showLoading: false,
        params
    })
}

// 档案归档-查询接口2.0
export function getPrjArchivesFile(data) {
    return request({
        url: moduleName + 'api/attachment/archives/getPrjArchivesFileInfo',
        method: 'post',
        showLoading: true,
        data
    })
}

// 信息化归档接口
export function pushArchives(params) {
    return request({
        url: moduleName + 'api/attachment/archives/pushArchives',
        method: 'post',
        showLoading: true,
        params
    })
}

// 信息化删除接口
export function pushDelete(params) {
    return request({
        url: moduleName + 'api/attachment/archives/pushDeleteArchives',
        method: 'post',
        showLoading: true,
        params
    })
}

// 信息化归档补传前校验状态
export function checkUploadArchives(params) {
    return request({
        url: moduleName + 'api/attachment/archives/checkUploadArchives',
        method: 'post',
        showLoading: true,
        params
    })
}

// 整体项目上传获取建设方式
export function queryBuildModesApi(params) {
    return request({
        url: moduleName + 'api/attachment/file/queryBuildModes',
        params
    })
}

// 跳转数字图纸
export function getDigitalDrawingsUrl(data) {
    return request({
        url: moduleName + 'api/attachment/file/getDigitalDrawingsUrl?prjId=' + data,
        method: 'get',
        showLoading: true
    })
}

// 获取令牌
export function getWPSToken() {
    return request({
        url: moduleName + 'api/preview/getWPS3Token',
        method: 'get',
        showLoading: true
    })
}

// 获取预览
export function getPreviewFile(data) {
    return request({
        url: moduleName + 'api/preview/files/'+data.fileId+'?type='+data.type+'&userId='+data.userId,
        method: 'get',
        headers:{ 'X-Weboffice-Token':data.token},
        showLoading: true
    })
}

//电子化文档生成
export function acceGenerationElectron(params) {
    return request({
        url: moduleName + 'api/attachment/file/acceGenerationElectron',
        method: 'post',
        showLoading: true,
        hideMessage: true,
        params
    })
}

// 电子化文档查看明细
export function queryElectronInfo(params) {
    return request({
        url: moduleName + 'api/attachment/file/queryElectronInfo',
        method: 'post',
        showLoading: true,
        params
    })
}
// 电子化文档查看明细
export function updateAccElectron(data) {
    return request({
        url: moduleName + '/api/attachment/file/updateAccElectron',
        method: 'post',
        showLoading: true,
        data
    })
}

// 电子化文档查看明细
export function checkFileEditing(params) {
    return request({
        url: moduleName + '/api/attachment/file/checkEditing',
        method: 'post',
        showLoading: true,
        params
    })
}

// 采购经理批量签章接口
export function batchSign(data) {
    return request({
        url: moduleName + 'api/signature/v2/pm/batchSign',
        method: 'post',
        showLoading: true,
        data
    })
}

// 采购经理签字环节的签字按钮事件
export function writeSignature(data) {
    return request({
        url: moduleName + `api/signature/v2/pm/batchSignature`,
        method: 'post',
        data,
        showLoading: true
    })
}
export function writeSignatureOld(data) {
    return request({
        url: moduleName + `api/signature/v2/pm/signature?docId=${data}`,
        method: 'get',
        showLoading: true
    })
}

// 上传电子签章时指派签署人
export function assignFixedSignatory(data) {
    return request({
        url: moduleName + 'api/signature/v2/assignFixedSignatory',
        method: 'post',
        showLoading: true,
        data
    })
}
